

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>网易126免费邮--选择用户名</title>
<link rel="stylesheet" href="http://mimg.126.com/reg/v2/css/reg1_CH0523.css" type="text/css">
<link rel="stylesheet" href="http://mimg.126.com/reg/v2/css/zc_addstyle.css" type="text/css"></head>

<SCRIPT LANGUAGE="JavaScript">
function setError(index) {
	document.getElementById( "errspan1" ).className = "";
	document.getElementById( "errspan2" ).className = "";
	document.getElementById( "errspan3" ).className = "";
	document.getElementById( "errspan" + index ).className = "error";
	document.getElementById("username").style.borderColor='red';
	changeUsernamePrompt(document.getElementById( "errspan" + index ).innerText);
}
function validate(){
	if(!checkUsername())return false;
	if(!checkBirthday())return false;	
	document.getElementById("divBirthday").style.display="none";
	return true;
}
function checkBirthday(){
	var year = parseInt(document.getElementById("txtYear").value);	
	var month = parseInt(document.getElementById("txtMonth").value);
	var day = parseInt(document.getElementById("txtDay").value);
	var iaMonthDays = [31,28,31,30,31,30,31,31,30,31,30,31];
	
	var regYear = new RegExp("^[\\d]{4}$","gi");
	var regMonth = new RegExp("^[\\d]{1,2}$","gi");
	var regDay = new RegExp("^[\\d]{1,2}$","gi");

	if (!regYear.test(year)||year < 1900 || year > 2100){
	 changeUsernamePrompt("请正确输入出生年份"); 
	 document.getElementById("txtYear").focus();
	 return false;
	}
	if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iaMonthDays[1]=29;
	if (!regMonth.test(month) || month < 1 || month > 12) {
		changeUsernamePrompt("请正确输入出生月份");
		document.getElementById("txtMonth").focus();
		return false;
	}
	if (!regDay.test(day)||day < 1 || day > iaMonthDays[month - 1]){
	 changeUsernamePrompt("请正确输入出生日期");
	 document.getElementById("txtDay").focus();
	 return false;
	}
	
	return true;
}
function checkUsername() {
	document.getElementById( "errspan1" ).className = "";
	document.getElementById( "errspan2" ).className = "";
	document.getElementById( "errspan3" ).className = "";
	changeUsernamePrompt("&nbsp;");
	var username = document.getElementById("username").value;
	if( username == "" || username == null ){
	document.getElementById("username").style.borderColor='red';
		changeUsernamePrompt( "请输入用户名，比如netease" + new Date().getFullYear() );
		return false;
	}
	var validFlag = isUsername( username );
	if (validFlag != 0) {
		setError(validFlag);
		return false;
	}
	return true;
}
function changeUsernamePrompt(cnt){
	document.getElementById( "divMessage" ).style.display="block";
	document.getElementById( "divRecommandName" ).style.display="none";
	document.getElementById( "failinfo" ).innerHTML = cnt;
}
<!-- add by ylq 20080408 -->
function showRecommandNames(message,recommandMessage){
	if(!recommandMessage){
		changeUsernamePromt(message);
		return false;
	}
	document.getElementById( "divMessage" ).style.display="block";
	document.getElementById( "failinfo" ).innerHTML = "";
	document.getElementById( "divRecommandName" ).style.display="block";
	document.getElementById( "stgMessage" ).innerHTML = message;
	document.getElementById( "divRecommandMessage" ).innerHTML = recommandMessage;
	
}
<!--end add -->
function chooseThis(name) {
	document.getElementById( "username" ).value = name;
}
function isUsername( username ){
	var re = /[!@#$%\^&\*\(\)]/g; 
	var err = "";
	while ((arr = re.exec(username)) != null)
       err += arr;
	if (err != "") {
		changeUsernamePrompt("用户名不能含有" + err.replace(/&/g, "&amp;"));
		return 1;
	} else if (/ /g.test(username)) {
		changeUsernamePrompt("用户名不能含有空格");
		return 1;
	}
	if(! /^.{5,20}$/.test( username ) ){
		return 3;
	}
	if(! /^[\w_]*$/.test( username ) ){
		return 1;
	}
	if(! /^([a-z]|[A-Z])[0-9a-zA-Z_]{4,19}$/.test( username ) ){
		return 2;
	}
	return 0;
}
var flag = false;
function gotoNextStep() {
	if (flag) {
		location.href='reg2.jsp';
		flag = false;
	}
}
</SCRIPT>
<body onload="document.getElementById('username').focus();">
<div id="top_logo"> <a href="http://www.126.com/"><img src="http://mimg.126.com/logo/126logo_tsp.gif" alt="网易126免费邮箱" width="145" height="30"  border="0" class="icon_img 126logo" style="margin-left:5px;" /></a>
  <div id="other_links">
    <div class="other_left fleft"></div>
    <div class="other_middle fleft"> <a href="http://www.163.com" target="_blank">网易首页</a> <a href="http://www.188.com/index.htm?from=126mail" target="_blank" class="red">188财富邮</a> <a href="http://mail.163.com" target="_blank">163邮箱</a> <a href="http://www.126.com/help/" target="_blank">帮助</a></div>
    <div class="other_right fright"></div>
  </div>
</div>
<div class="clear"></div>
<!--注册主体框架-->
<form action="checkusername.jsp" method="post" target="sypost" name="uform" onSubmit="return validate();">
<div class="main clear">
  <div class="main_title_green">
    <div class="green_title"><img src="http://mimg.126.com/reg/v2/img/arrow.gif" width="6" height="11" class="arrow"/>&nbsp;&nbsp;<span class="title_font_green1">已经注册了126免费邮？</span> <a href="http://mail.126.com" class="logon">登录</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="title_font_green2 hide">126免费邮全新推出网络记事本，火热试用中…… </span> </div>
	
    <div class="green_right fright"><a href="http://www.126.com/help/access.htm" target="_blank" class="logon ">注册帮助</a></div>
	
  </div>
  <!--主要内容页-->
  <p class="creat fleft clear">创建一个新的126邮箱地址</p>
  
    <!--错误提示 开始-->
<div id='divMessage' class="wrong_info" style='display:none'>
	  <!--普通提示 开始
	  1.用户名，生日日期填写错误，请重新填写
2.用户名，生日日期不能为空
3.用户名填写错误
4.生日日期填写错误
5.生日日期不能为空
6.用户名不能为空
	  -->
	  <span id='failinfo' class="w_nor" ></span>
	  <!--普通提示 结束-->
<div id='divRecommandName'  style="display:none">	 
 		<strong id='stgMessage'></strong><br />
		<div class="ts">取名提示：你可以把名字与<span class="Cblack">生日</span>，<span class="Cblack">幸运数字</span>组合或者<span class="Cblack">添加符号</span>等方式设置用户名，下面用户名推荐使用：</div>
		<div id='divRecommandMessage' class="yhm_C">

		</div>
</div>
</div>
  <!--错误提示 结束-->
  
  <p class="creat_name">用户名：
    <input type="text" size="20" maxLength="20" name="username" id="username" onfocus="this.style.borderColor='#99E300'" onblur="this.style.borderColor='#A3BFA8'" class="inp_errors" onkeydown="flag=true;"/>
    <span class="c126 font_space">@126.com</span></p>
 <!--增加部分20080331 开始-->
 <div id='divBirthday'> 	
 <p id='pBirthday' class="creat_name" style="text-align:left; padding-left:137px;">出生日期：
 <input id='txtYear' type="text" maxLength="4" name="year" onfocus="this.style.borderColor='#99E300'" onblur="this.style.borderColor='#A3BFA8'" style="width:45px"/> 年 <input id='txtMonth' type="text" maxLength="2" name="month" onfocus="this.style.borderColor='#99E300'" onblur="this.style.borderColor='#A3BFA8'" style=" width:26px"/> 月 <input id='txtDay' type="text" maxLength="2" name="day" onfocus="this.style.borderColor='#99E300'" onblur="this.style.borderColor='#A3BFA8'" style="width:26px"/> 日</p>
 	<div class="rqts">提示：出生日期将会是您拿回邮箱密码的重要凭证，请谨慎填写</div>
</div>
  <!--增加部分20080331 结束-->	
  <p class="explain">
    <span id="errspan1">1.用户名只能由英文字母a～z(不区分大小写)、数字0～9、下划线组成。</span><br />
    <span id="errspan2">2.用户名的起始字符必须是英文字母。如：netease_2005 </span><br />
    <span id="errspan3">3.用户名长度为5～20个字符。</span><br />
    <br />
    <input class="button_next" name="submit" type="submit" value="下一步" />
  </p>
  <br />
</div>
</form>
<!--版权信息-->
<div id="footer">
  <div class="other_left fleft"></div>
  <div class="other_middle fleft"><a href="http://corp.163.com/index_gb.html" target="_blank">公司简介</a> <a href="http://power.163.com/adpage/salescenter/index.html" target="_blank">广告服务</a> <a href="http://corp.163.com/gb/legal/legal.html" target="_blank">相关法律</a> <a href="http://www.126.com/help/spam_01.htm" target="_blank">反垃圾邮件政策</a> <span class="font_white">网易公司版权所有 <span class="STYLE1">&copy;</span>1997-<script>document.write(new Date().getFullYear());</script></span> </div>
  <div class="other_right fright"></div>
</div>
<iframe scrolling=no width=0 height=0 src="" name="sypost" id="sypost" style="display:none"></iframe>
</body>
</html>
